<template>
   <div id="momos" class="container">
       <MemoItem v-for="item in filterMemo()" :key="item.id" :memo="item"></MemoItem>
   </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import ItemData from "@/model/ItemData";
import MemoItem from "@/components/MemoItem.vue";
@Component ({
    components: {
        MemoItem
    }
})
export default class MemoList extends Vue{
    // 声明一个数组类型的熟悉，存放本地的数组
    memoArr: Array<ItemData> = this.$store.state.aHelper.memoList
    filterMemo() {
        if(this.$store.state.filterCateId ==-1) {
            return this.memoArr
        } else {
            return  this.memoArr.filter((ele: any) => {
                return ele.categoryId == this.$store.state.filterCateId
            })
        }
    }
}
</script>

<style scoped>

</style>